//
//  ImageModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/5.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "ImageModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface ImageModelCell ()
@property (weak, nonatomic) IBOutlet UIImageView *titleImageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *digestLabel;
@property (weak, nonatomic) IBOutlet UILabel *ptimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyCountLabel;


@end
@implementation ImageModelCell
- (void)setModel:(ImageModel *)model {
    if (_model != model) {
        _model = model;
    }
}
- (void)layoutSubviews {
    [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:self.model.imgsrc]];
    self.titleLabel.text = self.model.title;
    self.digestLabel.text = self.model.digest;
    self.ptimeLabel.text = self.model.ptime;
    self.replyCountLabel.text = [NSString stringWithFormat:@"%@",self.model.replyCount];
    self.titleImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(titleImageViewAction:)];
    [self.titleImageView addGestureRecognizer:tap];
}
- (void)titleImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.titleImageView];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
